package com.wanmait.baohan.handler;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author hxn
 * 拦截器实现未登录跳转到登录
 */
public class LoginHandler implements HandlerInterceptor {
    /**预处理拦截器*/
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        System.out.println("执行了拦截器");
//        if (request.getSession().getAttribute("user") == null){
//            response.sendRedirect("/login");
//            return false;
//        }
        return true;
    }
}
